1.- First we are going to define the function
(defun factorial (n)
"Returns factorial of the number n"
(if (= n 0)
1
(* n (factorial (- n 1)))))
2.- Set trace to function
(trace factorial *)
3.- Call the function
(factorial 3)
4.- Finally we show the results
0: (FACTORIAL 3)
1: (FACTORIAL 2)
2: (FACTORIAL 1)
3: (FACTORIAL 0)
3: FACTORIAL returned 1
2: FACTORIAL returned 1
1: FACTORIAL returned 2
0: FACTORIAL returned 6
#Lisp